home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 120
/
Vol 120.iso
/
games
/
orbitrax.swf
/
scripts
/
DefineSprite_681
/
frame_1
/
DoAction.as
Wrap
Text File
|
2010-11-09
|
3KB
|
103 lines
phase = 0;
enemiNbr = Number(this._name.substring(this._name.length - 1));
twinTarget = eval("gameMain.twins.twin" + enemiNbr);
if(main.gameType == "multiPlayer")
{
avatarTarget = eval("main.avatar" + enemiNbr);
var i = 0;
while(i < main.userRoom.userArrayRoom.length)
{
if(avatarTarget.userName.text == main.userRoom.userArrayRoom[i].userName)
{
if(main.userRoom.userArrayRoom[i].userType == "robot" && main.roomAdmin)
{
vSpeed = main.userRoom.userArrayRoom[i].userSpeed;
}
else
{
vSpeed = 0;
}
break;
}
i++;
}
}
if(vSpeed == undefined)
{
eval("gameMain.twins.twin" + enemiNbr).actif = false;
_visible = false;
}
else if(vSpeed != 0)
{
vx = vy = 0;
seg = 41;
seg2 = 42;
mid1 = new Object();
mid2 = new Object();
point2 = new Object();
t = 1;
turn = 0;
this.incSeg = function()
{
seg++;
seg2 = seg + 1;
if(seg >= gameMain.numPoints - 1)
{
seg2 = 0;
}
if(seg >= gameMain.numPoints)
{
seg = 0;
seg2 = 1;
}
};
this.tTween = function()
{
if(main.gameStarted)
{
t += speed;
if(t > 0.99)
{
t = 0;
incSeg();
speed = vSpeed;
mid1.x = gameMain.mid[seg].x;
mid1.y = gameMain.mid[seg].y;
point2.x = gameMain.points[seg2]._x;
point2.y = gameMain.points[seg2]._y;
mid2.x = gameMain.mid[seg2].x;
mid2.y = gameMain.mid[seg2].y;
}
_X = mid1.x * (1 - t) * (1 - t) + 2 * point2.x * (1 - t) * t + mid2.x * t * t;
_Y = mid1.y * (1 - t) * (1 - t) + 2 * point2.y * (1 - t) * t + mid2.y * t * t;
vx = _X - oldx;
vy = _Y - oldy;
oldx = _X;
oldy = _Y;
twinTarget._x = _X;
twinTarget._y = _Y;
if(seg == 42 && seg2 == 43 && phase > 0)
{
if(phase == 1)
{
avatarTarget.star.nextFrame();
turn++;
phase = 0;
}
if(turn >= gameMain.turnTotal)
{
phase = -1;
vSpeed = 0;
main.stopGame("robot");
}
}
else if(seg == 1 && seg2 == 2)
{
phase = 1;
}
}
};
this.onEnterFrame = this.tTween;
}
stop();